<div class="layui-layout layui-layout-admin">
  <div class="layui-header" id="app-header">
    <script
      type="text/html"
      template
      lay-done="layui.element.render('nav','nepadmin-header')"
    >
      <ul class="layui-nav layui-layout-left" lay-filter="nepadmin-header">
          <li class="layui-nav-item" lay-unselect>
              <a nepadmin-event="flexible">
                  <i class="layui-icon layui-icon-shrink-right"></i>
              </a>
          </li>
      </ul>
      <ul class="layui-nav layui-layout-right" lay-filter="nepadmin-header">
          <li class="layui-nav-item layui-hide-xs" lay-unselect>
              <a nepadmin-event="fullscreen" title="切换全屏">
                  <i class="layui-icon layui-icon-screen-full"></i>
              </a>
          </li>
<!--          <li class="layui-nav-item layui-hide-xs" lay-unselect>-->
<!--              <a class="layui-hide-xs">-->
<!--                  <span lay-filter="lig-language">简体中文</span>-->
<!--                  <i class="layui-icon layui-icon-triangle-d"></i>-->
<!--              </a>-->
<!--              <dl class="layui-nav-child">-->
<!--                  <dd><a nepadmin-event="languageCN">简体中文</a></dd>-->
<!--                  <dd><a nepadmin-event="languageUS">English</a></dd>-->
<!--              </dl>-->
<!--          </li>-->
          <li class="layui-nav-item" lay-unselect>
              <a class="layui-hide-xs">
                  <label lig-lang="layout-welcome">欢迎回来</label>，{{ layui.admin.data()['user'].userName  }}
                  <i class="layui-icon layui-icon-triangle-d"></i>
              </a>
              <a class="layui-hide-sm layui-show-xs-inline-block">
                  <i class="layui-icon layui-icon-username"></i>
              </a>
              <dl class="layui-nav-child">
                  <!--<dd><a href="javascript:void(0);" nepadmin-event="lig-userInfo">个人信息</a></dd>-->
                  <dd><a href="javascript:void(0);" nepadmin-event="lig-userInfo" lig-lang="layout-userInfo">设置</a></dd>
                  <hr/>
                  <dd><a href="javascript:void(0);" nepadmin-event="logout" lig-lang="layout-logout">退出登录</a></dd>
              </dl>
          </li>
      </ul>
    </script>
  </div>

  <div class="nepadmin-tabs-hidden">
    <script type="text/html" id="TPL-app-tabsmenu" template>
      {{# if(layui.conf.viewTabs == true){ }}
      <div class="nepadmin-tabs-wrap">
          <span class="nepadmin-tabs-btn nepadmin-tabs-action nepadmin-tabs-prev" data-type="prev">
              <i class="layui-icon layui-icon-left"></i>
          </span>
          <span class="nepadmin-tabs-btn nepadmin-tabs-action nepadmin-tabs-next" data-type="next">
              <i class="layui-icon layui-icon-right"></i>
          </span>
          <span class="nepadmin-tabs-btn nepadmin-tabs-action nepadmin-tabs-down" data-type="down">
              <i class="layui-icon layui-icon-close"></i>
          </span>
          <ul class="nepadmin-tabs-menu">
              {{# layui.each(layui.view.tab.data,function(i,item){ }}<li data-type="page" class="nepadmin-tabs-btn" lay-url="{{item.fileurl}}"><i class="nepadmin-tabs-ball"></i>{{ item.title }}<b class="layui-icon layui-icon-close nepadmin-tabs-close"></b></li>{{# }) }}
          </ul>
      </div>
      {{# } }}
    </script>
  </div>

  <!-- 侧边菜单 -->
  <div class="layui-side" id="app-sidebar">
    <div class="layui-side-scroll">
      <div class="layui-logo">
          <div class="layui-logo">
            <span lay-filter="sys-name"><b>银税信息</b>系统</span>
<!--              <div style="height: 75px;line-height: 75px;">-->
<!--                  <img src="/static/nepadmin/images/logo.jpeg" style="width: 100%;height: 80%;vertical-align: top;">-->
<!--              </div>-->
              <!-- <div style="font-size: 20px;margin: 0px;height: 40px;line-height: 40px;color: #fff;">
                  客户管理系统
              </div> -->
          </div>
      </div>
      <script
        type="text/html"
        template
        lay-api="getMenu"
        lay-done="layui.element.render('nav','nepadmin-sidebar');layui.admin.sidebarFocus()"
      >
        <ul class="layui-nav layui-nav-tree" lay-filter="nepadmin-sidebar" >
            {{#
                function __createSlidebar(data,index){
                    if(!data || data.length == 0) return '';
                    var html = '<dl class="layui-nav-child">';
                    layui.each(data,function(i,child){
                        html += '<dd><a style="padding-left:' + (index == 0 ? 50 : 50 + index * 20) + 'px" target="'+(child.target||'')+'" lay-href="'+ (child.url||'') +'">' + child.name + '</a>';
                        if(child.children) html += __createSlidebar(child.children, index+1);
                        html += '</dd>';
                    });
                    html = html +'</dl>';
                    return html;
                }
                layui.each(d,function(i,child){
            }}
            <li class="layui-nav-item">
                <a lay-href="{{child.url||''}}" target="{{child.target||''}}" title="{{child.name}}"><i class="layui-icon {{child.icon}}"></i>{{child.name}} {{# if(child.notice){ }}<span class="layui-badge">{{ child.notice }}</span>{{# } }}</a>
                {{ __createSlidebar(child.children,0) }}
            </li>
            {{# }) }}
        </ul>
      </script>
    </div>
  </div>

  <!-- 主体内容 -->
  <div class="layui-body" id="app-body"></div>
</div>
<script>
layui.use(['view', 'jquery', 'lig'],function(view, $, lig){
    view.request({
        type: 'get',
        url: '/framework/i18n/locale/context',
        success: function (result) {
            var lang = $('[lay-filter="lig-language"]');
            if (result.data == 'en') {
                lang.text('English');
            } else {
                lang.text('简体中文');
            }
        }
    });
    view.request({
        type: 'get',
        url: '/auth/session-info',
        success: function(result) {
          $('[lay-filter="sys-name"]').html(result.data.tenantName);
        }
    });
});
</script>